﻿@model IEnumerable<SportsStore.Domain.Entities.Product>

@{
    ViewBag.Title = "Admin: All Products";
    Layout = "~/Views/Shared/_AdminLayout.cshtml";
}

<h1>All Products</h1>

<table class="Grid">
    <tr>
        <th>
            ID
        </th>
        <th>
            Name
        </th>
        <th class="NumericalCol">
            Price
        </th>
        <th>
            Actions
        </th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @item.ProductID
        </td>
        <td>
            @Html.ActionLink(item.Name, "Edit", new { item.ProductID})
        </td>
        <td class="NumericalCol">
            @item.Price.ToString("c")
        </td>
        <td>
            @using (Html.BeginForm("Delete", "Admin"))
            {
                @Html.Hidden("ProductId", item.ProductID)
                <input type="submit" value="Delete" />
            }
        </td>
    </tr>
}

</table>

<p>
    @Html.ActionLink("Add a new product", "Create")

</p>